import { asyncFormat } from '@/utils'


//mock
export const getCarTeamList = () => Promise.resolve([
        {
            id: 'xxx',
            title: 'xxx'
        },
        {
            id: 'ccc',
            title: 'ccc'
        }
    ])


//mock
export const getCarTeamCompany = () => Promise.resolve([
    {
        id: 'xxx',
        title: 'xxx'
    },
    {
        id: 'ccc',
        title: 'ccc'
    }
])


export const loadOptionsWrap = function(prop, load){
    return async function(){
        const [res, err] = await asyncFormat(load())
        if(err){console.error(err); return}
        this[prop] = res
    }
}


// mock
export const getTableList = param => {
    console.log(param)
    return Promise.resolve([
        {   
            id: 'oooo',
            status: 0,
            index: 0,
            publisher: 'xxx',
            balance_type: 0,
            abnormal_end: 1,
        },
        {   
            id: 'oooo',
            status: 120,
            index: 1,
            publisher: 'xxx',
            balance_type: 0,
            abnormal_end: 1,
        },
        {   
            id: 'oooo',
            status: 122,
            index: 2,
            publisher: 'xxx',
            balance_type: 0,
            abnormal_end: 1,
        }        
    ])
}